ostree_LDADD = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_GIO_UNIX_LIBS)
if USE_LIBSOUP
-bin_PROGRAMS += ostree-pull
-ostree_pull_SOURCES = src/ostree/ot-main.h \
- src/ostree/ot-main.c \
- src/ostree/ostree-fetcher.h \
+ostree_SOURCES += src/ostree/ostree-fetcher.h \
src/ostree/ostree-fetcher.c \
- src/ostree/ostree-pull.c
+ src/ostree/ostree-pull.c \
+ $(NULL)
-ostree_pull_CFLAGS = $(ostree_bin_shared_cflags) $(OT_INTERNAL_SOUP_CFLAGS)
-ostree_pull_LDADD = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_SOUP_LIBS)
+ostree_CFLAGS += $(OT_INTERNAL_SOUP_CFLAGS)
+ostree_LDADD += $(OT_INTERNAL_SOUP_LIBS)
endif
MANPAGES += doc/ostree.1
{ "log", ostree_builtin_log, 0 },
{ "ls", ostree_builtin_ls, 0 },
{ "prune", ostree_builtin_prune, 0 },
- { "pull", NULL, 0 },
+ { "pull", ostree_builtin_pull, 0 },
{ "pull-local", ostree_builtin_pull_local, 0 },
{ "remote", ostree_builtin_remote, 0 },
{ "rev-parse", ostree_builtin_rev_parse, 0 },
{ NULL }
};
-static int
-exec_external (int argc,
- char **argv,
- GError **error)
-{
- gchar *command;
- gchar *tmp;
- int errn;
-
- command = g_strdup_printf ("ostree-%s", argv[1]);
-
- tmp = argv[1];
- argv[1] = command;
-
- execvp (command, argv + 1);
-
- errn = errno;
- argv[1] = tmp;
- g_free (command);
-
- if (errn == ENOENT)
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
- "Unknown command: '%s'", argv[1]);
- }
- else
- {
- g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errn),
- "Failed to execute command: %s", g_strerror (errn));
- }
-
- return 1;
-}
-
int
main (int argc,
char **argv)
int ret;
ret = ostree_run (argc, argv, commands, &error);
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
- {
- g_clear_error (&error);
- ret = exec_external (argc, argv, &error);
- }
-
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
ostree_usage (argv, commands, TRUE);
#include "ostree.h"
#include "ot-main.h"
+#include "ot-builtins.h"
#include "ostree-fetcher.h"
return ret;
}
-static gboolean
+gboolean
ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
{
GOptionContext *context;
soup_uri_free (summary_uri);
return ret;
}
-
-static OstreeCommand commands[] = {
- { "pull", ostree_builtin_pull, 0 },
- { NULL }
-};
-
-int
-main (int argc,
- char **argv)
-{
- return ostree_main (argc, argv, commands);
-}
return gs_subprocess_simple_run_sync (gs_file_get_path_cached (ostree_dir),
GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
- "ostree", "pull", repo_arg, osname, NULL);
+ "ostree", repo_arg, "pull", osname, NULL);
}
void
gboolean ostree_builtin_commit (int argc, char **argv, GFile *repo_path, GError **error);
gboolean ostree_builtin_diff (int argc, char **argv, GFile *repo_path, GError **error);
gboolean ostree_builtin_init (int argc, char **argv, GFile *repo_path, GError **error);
+gboolean ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error);
gboolean ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **error);
gboolean ostree_builtin_log (int argc, char **argv, GFile *repo_path, GError **error);
gboolean ostree_builtin_ls (int argc, char **argv, GFile *repo_path, GError **error);